#include<iostream>
using namespace std;

class woof
{
public:
    virtual void display()const
    {
        cout<<"display"<<endl;
    }
};

class woof1:public woof{
public:
    void display() const override
    {
        cout<<"a1"<<endl;
    }

};

class woof2:public woof1{
public:
    void display()const override
    {
        cout<<"a2"<<endl;
    }

};

int mian()
{
    woof* woof[2];
    woof[0]=new woof1();
    woof[1]=new woof2();
    for(int i=0;i<2;i++)
    {
        woof[i]->display();
        delete woof[2];
    }
    return 0;
}